package com.coffee.service.impl;

import com.coffee.common.BaseContext;
import com.coffee.dao.CouponDAO;
import com.coffee.entity.Coupon;
import com.coffee.service.CouponService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CouponServiceImpl implements CouponService {

    @Autowired
    private CouponDAO couponDAO;
    @Override
    public List<Coupon> list() {
        String id = BaseContext.get();
        return couponDAO.list(id);
    }

    @Override
    public void deleteById(String id) {
        couponDAO.deleteById(id);
    }

    @Override
    public void addCoupon(Coupon coupon) {
        couponDAO.insertCoupon(coupon);
    }

    @Override
    public List<Coupon> select() {
        return couponDAO.select();
    }

    @Override
    public void updateCoupon(Coupon coupon) {
        couponDAO.update(coupon);
    }
}
